#define _CRT_SECURE_NO_WARNINGS



#include<iostream>
using namespace std;
typedef long long LL;
const int N = 1e5 + 10;
int n, m, k;
//int f[N];
//int a[N];
LL ret;
int main()
{
    cin >> n >> m >> k;
    for (int i = 1; i <= m; i++)
    {
        int l, r;
        cin >> l >> r;
        ret += (r - l);
    }
    cout << ret;
    return 0;
}

